<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2012.03.17.
   装修效果图($$)*/

!defined('Q_PATH') && exit;

class Index_C_Controller extends InitController{

	public function index(){
		// 站点
		if($this->isPost()){
			C::urlGo(Jiaju_Extend::getPhotoList(null,null,intval(Q::G('site_id','P')),0));
		}

		$nSpid=intval(Q::G('spid','G'));
		$nStid=intval(Q::G('stid','G'));
		$nSiteid=intval(Q::G('site_id','G'));
		
		// 载入相关缓存
		Core_Extend::loadCache('jiaju_caseclass');
		Core_Extend::loadCache('slide');
		
		// 当前设计作品
		$arrWhere=array();
		$arrWhere['A.jiajucase_status']=1;

		// 属性筛选
		$sSpTitle=$sStTitle=$sSiteTitle='';
		if($nSpid){
			$arrWhere['A.jiajucase_spaceid']=$nSpid;
			$sSpTitle=Model::F_('jiajucompanyclass','jiajucompanyclass_id=?',$nSpid)->getColumn('jiajucompanyclass_name');
		}
		if($nStid){
			$arrWhere['A.jiajucase_styleid']=$nStid;
			$sStTitle=Model::F_('jiajucompanyclass','jiajucompanyclass_id=?',$nStid)->getColumn('jiajucompanyclass_name');
		}
		if($nSiteid){
			$arrWhere['A.site_id']=$nSiteid;
			$sSiteTitle=Model::F_('site','site_id=?',$nSiteid)->getColumn('site_name');
		}

		$nTotal=Model::F_('jiajucase','@A')->where($arrWhere)->getCounts();
		$oPage=Page::RUN($nTotal,20,Jiaju_Extend::getPhotoList(null,null,null,'{page}',false));
		$arrJiajucases=Model::F_('jiajucase','@A')
			->setColumns('A.jiajucase_id,A.jiajucase_title,A.jiajucase_thumb,A.create_dateline')
			->where($arrWhere)
			->order('A.jiajucase_id DESC')
			->limit($oPage->S(),$oPage->N())
			->getAll();

		Core_Extend::getSeo($this,array(
			'title'=>($sSiteTitle?"站点{$sSiteTitle}装修效果图-":'').
				($sSpTitle?"{$sSpTitle}空间装修效果图-":'').
				($sStTitle?"{$sStTitle}风格装修效果图-":'').
				$GLOBALS['_option_']['site_name']."装修效果图-中国装修摄影图库相册",
			'keywords'=>($sSiteTitle?"站点{$sSiteTitle}装修效果图,":'').
				($sSpTitle?"{$sSpTitle}空间装修效果图,":'').
				($sStTitle?"{$sStTitle}风格装修效果图,":'').
				$GLOBALS['_option_']['site_name']."装修效果图,中国装修摄影图库相册",
			'description'=>($sSiteTitle?"站点{$sSiteTitle}装修效果图-":'').
				($sSpTitle?"{$sSpTitle}空间装修效果图-":'').
				($sStTitle?"{$sStTitle}风格装修效果图-":'').
				$GLOBALS['_option_']['site_name']."装修摄影图库，原创装修摄影图片照片欣赏，大量原创装修效果图素材、装修作品、装修样板房，强烈展示大片装修风格的大型综合图库。",
		),true,true);

		$this->assign('arrJiajucases',$arrJiajucases);
		$this->assign('sPageNavbar',$oPage->P(array('id'=>'pagination','style'=>'li','current'=>'active')));
		$this->assign('arrCaseClasss',$GLOBALS['_cache_']['jiaju_caseclass']);
		$this->assign('sSpTitle',$sSpTitle);
		$this->assign('sStTitle',$sStTitle);
		$this->assign('sSiteTitle',$sSiteTitle);
		$this->assign('arrCaseClasss',$GLOBALS['_cache_']['jiaju_caseclass']);
		$this->assign('arrSlides',$GLOBALS['_cache_']['slide']);
		$this->display('photo+index');
	}

}
